package service

import (
	"project_base_framework/dao"
	"project_base_framework/params"
	"project_base_framework/response"
)

type UserService struct {
}

func NewUserService() *UserService {
	return &UserService{}
}

// Login 用户登录
func (userService *UserService) Login(loginParamVO *params.LoginParamVO) (*response.LoginResponseDTO, error) {
	userDAO := dao.NewUserDAO()
	user, err := userDAO.Login(loginParamVO)
	if err != nil {
		return nil, err
	}
	var loginResponseDTO = &response.LoginResponseDTO{}
	loginResponseDTO.UserName = user.Username
	loginResponseDTO.Id = user.Id
	return loginResponseDTO, nil
}
